<?php
/**
 * @package		简易CMS
 * @subpackage	计划任务：清除垃圾
 * @version		$Id: cron_cleanup_daily.php 8 2012-06-07 12:37:35Z htmambo@gmail.com $
 * @author		Hoping
 * @copyright	Copyright (C) 2009 - 2010 Hoping Software Studio. All rights reserved.
 */

if(!defined('IN_JYCMS')) {
	exit('Access Denied');
}

DB::query("UPDATE #__common_advertisement SET available='0' WHERE endtime>'0' AND endtime<='$_G[timestamp]'", 'UNBUFFERED');
if(DB::affected_rows()) {
	require_once libfile('function/cache');
	updatecache(array('setting', 'advs'));
}
DB::query("TRUNCATE #__common_searchindex");

DB::query("DELETE FROM #__common_notification WHERE uid>0 AND new=0 AND dateline<'$_G[timestamp]-172800'", 'UNBUFFERED');
//清除1个月前关闭的关键词
$t = time()-2592000;
$data = "DELETE FROM #__focus_keywords WHERE enabled=0 AND readtime<'$_G[timestamp]-2592000'";
savetofile($data, 'e:/usr/htdocs/sharebar/xx.txt');
savetofile(dgmdate($_G[timestamp]-2592000, "Y-m-d H:i:s"), 'e:/usr/htdocs/sharebar/xx.txt');
DB::query("DELETE FROM #__focus_keywords WHERE enabled=0 AND readtime<'$_G[timestamp]-2592000'");
//DB::delete('focus_keywords', "enabled=0 AND readtime<'$_G[timestamp]-2592000'");
include_once libfile('function/block');
block_clear();
